I recently attended SQL Saturday in Pittsburgh. It was a great event and I was impressed with the presenters.
We all know that typing SQL on the fly during a live demo is never a good idea. One little typo and you might have to spend several awkward minutes trying to figure out what just went wrong. Your audience doesn’t want to see that, and you don’t want to be stressed about your demo. So it’s best to prepare your scripts in advance.
All of the presenters I saw atthis event had prepared scripts and I noticed something interesting. The presenters would use one of two ways to present SQL examples, and there are pros and cons to both:
Option 1 – Each SQL Example stored in a separate file
Pros:
-
Filenames were a really easy way to identify which script was needed for which example.
-
You don’t have to worry about running SQL in other examples by accident (as long as you’re in the right file).
Cons:
-
Presenters had to open up each script, which could be time consuming if they had to browse to it (work around this by putting all your scripts in the same folder and using a good naming convention).
-
Lots of query windows might be open, making it difficult to find the script you need, especially if it’s hidden in the active files drop down.
-
It might be hard to jump back to a previous script if there’s a question, especially if you closed it.
-
Every time you open a script, you need to increase the font size so the audience can see it, zooming in on both the text and the results (you could work around this by changing your default font size. Make sure you do this before your presentation because changing the grid results font size requires restarting SSMS.)
Option 2 – Use one file for all the scripts
The way this works is that all your scripts are in one file and you just have to highlight a subset of the script that you’re currently talking about, and execute that.
Pros:
-
Only one file is open.
-
You can easily scroll up to the previous example if you need to refer to it.
-
You only have to adjust the zoom once so the audience can see the SQL, and you don’t have to worry about changing it again.
Cons:
-
Highlighting a subset of your script takes time.
-
You might not highlight the entire SQL script and get an error (missed the S in SELECT).
-
Or, even worse, what if you accidentally forget to highlight a subset of your script and you click F5, the rest of your talk could be ruined 🙁
Here’s the SQL Prompt Trick
You could use Option 2 and try SQL Prompt’s new Shift + F5 feature, which executes only the current statement where your cursor is. This saves you from having to highlight a block of text with either your mouse or the keyboard and avoids the first 2 cons of Option 2. This is especially helpful if the query is really long.
For example, if you have a query containing two statements and your cursor is placed on the second statement.
When you press Shift + F5, only the second statement is executed. It’s as if you highlighted the second line and then hit F5.
If your example has a few SQL statements, you can execute the current batch by pressing Alt + Shift + F5. This executes everything from the GO statement above the cursor to the next GO statement.
You can also execute to the cursor by pressing Ctrl + Shift + F5. This executes everything from the start of the script to the cursor, including the current statement where the cursor is.
The 3rd con is still a huge problem and you have to be extremely careful that you don’t hit just F5 by mistake.
Give it a try?
I’d love to hear from you if you’re doing SQL Demos. Are thereother pros/cons that I didn’t mention?Which option do you use? Or do you do something different? The next time you’re giving a SQL demo, give this SQL Prompt trick a try and let me know what you think.
Best of luck with your demos! 🙂
-
Get the latest SQL Prompt or a free trial
-
Check out all the new features in SQL Prompt 6.4
Load comments